import { HttpGet, HttpPost, HttpUpload } from '@/api/index.js'

/**
 * 添加管理员用户
 * @param adminUser
 */
export const add = (adminUser) => {
    return HttpPost('/admin/system/adminUser/add', adminUser)
}

/**
 * 获取系统用户详情
 * @param id
 */
export const detail = (id) => {
    return HttpGet('/admin/system/adminUser/detail', {id})
}

/**
 * 管理员用户分页列表
 * @param adminUserReq
 */
export const pageList = (adminUserReq) => {
    return HttpGet('/admin/system/adminUser/pageList', adminUserReq)
}

/**
 * 列表
 * @param query 查询条件
 */
export const list = (query) => {
    return HttpPost('/admin/system/adminUser/list', query)
}

/**
 * 用户选择器下拉菜单数据集合
 * @param search 搜索条件
 */
export const listSysUserSelectorData = (search) => {
    return HttpGet('/admin/system/adminUser/listSysUserSelectorData', search)
}

/**
 * 获取下拉列表
 */
export const selectList = () => {
    return HttpGet('/admin/system/adminUser/selectList')
}

/**
 * 更新
 * @param adminUser
 */
export const update = (adminUser) => {
    return HttpPost('/admin/system/adminUser/update', adminUser)
}

/**
 * 根据ID删除
 * @param id
 */
export const deleteById = (id) => {
    return HttpPost('/admin/system/adminUser/deleteById/' + id)
}

/**
 * 发送绑定邮箱验证码
 * @param email
 */
export const sendBindEmailCode = (email) => {
    return HttpGet('/admin/system/adminUser/sendBindEmailCode', {email})
}

/**
 * 绑定邮箱
 * @param adminUserEmailBind
 */
export const bindEmail = (adminUserEmailBind) => {
    return HttpPost('/admin/system/adminUser/bindEmail', adminUserEmailBind)
}

/**
 * 发送绑定手机号的验证码
 * @param phone
 */
export const sendBindPhoneCode = (phone) => {
    return HttpPost('/admin/system/adminUser/sendBindPhoneCode', {phone})
}

/**
 * 绑定手机号
 * @param adminUserPhoneBind
 */
export const bindPhone = (adminUserPhoneBind) => {
    return HttpPost('/admin/system/adminUser/bindPhone', adminUserPhoneBind)
}

/**
 * 密码修改
 * @param adminUserPasswordModify
 */
export const modifyPassword = (adminUserPasswordModify) => {
    return HttpPost('/admin/system/adminUser/modifyPassword', adminUserPasswordModify)
}

/**
 * 重置用户密码
 * @param id
 */
export const resetPassword = (id) => {
    return HttpPost('/admin/system/adminUser/resetPassword', {id})
}

/**
 * 更新头像
 * @param file
 */
export const uploadAvatar = (file) => {
    return HttpUpload('/admin/system/adminUser/uploadAvatar', {file})
}

/**
 * 绑定角色
 * @param userId 用户ID
 * @param roleIds 角色ID集合
 */
export const bindRoles = (userId, roleIds) => {
    return HttpPost('/admin/system/adminUser/bindRoles', {userId, roleIds})
}

/**
 * 获取当前用户的菜单项目
 */
export const allMenus = () => {
    return HttpGet('/admin/system/adminUser/allMenus')
}

/**
 * 注销
 */
export const logout = () => {
    return HttpPost('/admin/system/adminUser/logout')
}
